package com.ww.java8.fp.lambda;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

/**
 * TODO
 *
 * @author wanggw
 * @date 2022-11-07 23:26:50
 */
public class LambdaDemo1 {

    public static void main(String[] args) throws IOException {
        System.out.println(processFile((BufferedReader br) -> br.readLine()));
        System.out.println("****************************");
        System.out.println(processFile((BufferedReader br) -> br.readLine() + br.readLine()));
    }

    public static String processFile(BufferedReaderProcessor p) throws IOException {
        try (BufferedReader br = new BufferedReader(new FileReader("D:/test/data.txt"))) {
            return p.process(br);
        }
    }
}
